package Client;
import java.awt.*;
import java.awt.event.*;
import java.util.HashMap;

import javax.swing.*;

public class PiecesContainer {
	
	private static PiecesContainer instance;
	private HashMap<String, ImageIcon> pieceIcons; 
	public PiecesContainer() {
		pieceIcons = new HashMap<String, ImageIcon>();
		addChessPieces();
	}
	
	public static PiecesContainer getInstance()
    {
        if(instance == null)
        {
            instance = new PiecesContainer();
        }
        
        return instance;
    }
	
	private void addChessPieces() {
		ImageIcon whiteKingWhite = new ImageIcon("Images/WhiteKingWhite.gif");
		ImageIcon whiteBishopWhite = new ImageIcon("Images/WhiteBishopWhite.gif");
		ImageIcon whitePawnWhite = new ImageIcon("Images/WhitePawnWhite.gif");
		ImageIcon whiteQueenWhite = new ImageIcon("Images/WhiteQueenWhite.gif");
		ImageIcon whiteKnightWhite = new ImageIcon("Images/WhiteKnightWhite.gif");
		ImageIcon whiteRookWhite = new ImageIcon("Images/WhiteRockWhite.gif");
		
		ImageIcon whiteKingBlack = new ImageIcon("Images/WhiteKingBlack.gif");
		ImageIcon whiteBishopBlack = new ImageIcon("Images/WhiteBishopBlack.gif");
		ImageIcon whitePawnBlack = new ImageIcon("Images/WhitePawnBlack.gif");
		ImageIcon whiteQueenBlack = new ImageIcon("Images/WhiteQueenBlack.gif");
		ImageIcon whiteKnightBlack = new ImageIcon("Images/WhiteKnightBlack.gif");
		ImageIcon whiteRookBlack = new ImageIcon("Images/WhiteRockBlack.gif");
		
		ImageIcon blackKingWhite = new ImageIcon("Images/BlackKingWhite.gif");
		ImageIcon blackBishopWhite = new ImageIcon("Images/BlackBishopWhite.gif");
		ImageIcon blackPawnWhite = new ImageIcon("Images/BlackPawnWhite.gif");
		ImageIcon blackQueenWhite = new ImageIcon("Images/BlackQueenWhite.gif");
		ImageIcon blackKnightWhite = new ImageIcon("Images/BlackKnightWhite.gif");
		ImageIcon blackRookWhite = new ImageIcon("Images/BlackRockWhite.gif");
		
		ImageIcon blackKingBlack = new ImageIcon("Images/BlackKingBlack.gif");
		ImageIcon blackBishopBlack = new ImageIcon("Images/BlackBishopBlack.gif");
		ImageIcon blackPawnBlack = new ImageIcon("Images/BlackPawnBlack.gif");
		ImageIcon blackQueenBlack = new ImageIcon("Images/BlackQueenBlack.gif");
		ImageIcon blackKnightBlack = new ImageIcon("Images/BlackKnightBlack.gif");
		ImageIcon blackRookBlack = new ImageIcon("Images/BlackRockBlack.gif");
		
		
			pieceIcons.put("whiteKingWhite", whiteKingWhite);
			pieceIcons.put("whiteBishopWhite", whiteBishopWhite);
			pieceIcons.put("whitePawnWhite", whitePawnWhite);
			pieceIcons.put("whiteQueenWhite", whiteQueenWhite);
			pieceIcons.put("whiteKnightWhite", whiteKnightWhite);
			pieceIcons.put("whiteRookWhite", whiteRookWhite);
			
			pieceIcons.put("whiteKingBlack", whiteKingBlack);
			pieceIcons.put("whiteBishopBlack", whiteBishopBlack);
			pieceIcons.put("whitePawnBlack", whitePawnBlack);
			pieceIcons.put("whiteQueenBlack", whiteQueenBlack);
			pieceIcons.put("whiteKnightBlack", whiteKnightBlack);
			pieceIcons.put("whiteRookBlack", whiteRookBlack);
			
			pieceIcons.put("blackKingWhite", blackKingWhite);
			pieceIcons.put("blackBishopWhite", blackBishopWhite);
			pieceIcons.put("blackPawnWhite", blackPawnWhite);
			pieceIcons.put("blackQueenWhite", blackQueenWhite);
			pieceIcons.put("blackKnightWhite", blackKnightWhite);
			pieceIcons.put("blackRookWhite", blackRookWhite);
			
			pieceIcons.put("blackKingBlack", blackKingBlack);
			pieceIcons.put("blackBishopBlack", blackBishopBlack);
			pieceIcons.put("blackPawnBlack", blackPawnBlack);
			pieceIcons.put("blackQueenBlack", blackQueenBlack);
			pieceIcons.put("blackKnightBlack", blackKnightBlack);
			pieceIcons.put("blackRookBlack", blackRookBlack);
		
	}
	
	public ImageIcon getPiece(String name) {
		return pieceIcons.get(name);
	}
	
	
	

}
